﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="入库明细汇总.aspx.cs" Inherits="syc.ZhiJian.Report.入库明细汇总" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title></title>
    <script type="text/javascript" language="javascript" src="/common.js"></script>
    <script src="../jquery.js" type="text/javascript"></script>
    <script type="text/javascript" language="javascript" >
        
        //PAGE_LOAD()
        $(document).ready(function() {
                 //截止日期默认取当天
                    $('#Date1').change(function() {
                        if ($('#Date2').val() == "") {
                            $('#Date2').val($('#Date1').val());
                        }
                    });
                    //清空两个日期框
                    $('#clear').click(function() {
                        $('#Date1').val("");
                        $('#Date2').val("");
                    });
        });						
    </script>
</head>
<body>
    <form id="form1" runat="server">
  
   <div class="hooo">
        <div id="wintop" class="wintop"><span lang="zh-cn"><u>入库明细汇总</u></span></div>
        <asp:Panel ID="Panel1" runat="server" CssClass="panel" Height="36px" >
  
        <table>
        <tr id="row2" runat="server">
        <td>         
        <span style="width:220px;text-align:right;">
            起始日期：<asp:TextBox ID="Date1" runat="server" CssClass="intxt1" Width="120px" AutoPostBack="true"></asp:TextBox><img alt="" src="/Icons/29.png" align="middle" onclick="makecalendar(document.getElementById('Date1').value, document.getElementById('Date1'));" />
        </span>
        </td>
        
        <td>
        <span style="width:220px;text-align:right;">
            截止日期：<asp:TextBox ID="Date2" runat="server" CssClass="intxt1" Width="120px" AutoPostBack="true"></asp:TextBox><img alt="" src="/Icons/29.png" align="middle" onclick="makecalendar(document.getElementById('Date2').value, document.getElementById('Date2'));" />
        </span>
        <input type="button" class="button" id="clear" value="清空日期"/>
        </td>
        <td>&nbsp;&nbsp;&nbsp;<asp:Button ID="Query" runat="server" CssClass="button" Text="生成报表" onclick="Query_Click" /></td>
        <td><asp:Button ID="Button1" runat="server" CssClass="button" Text="导出" onclick="Button1_Click" /></td>
        </tr>
        </table>

        </asp:Panel>
        <asp:Panel ID="Panel2" runat="server" CssClass="panel2">
        <asp:Label ID="Message" runat="server" Text="·准备就绪" CssClass="prompt" Visible="True"></asp:Label>
        </asp:Panel> 
    

        <div align="center" id="report"">    
                <h1 style="text-align: center;">
            <%=Date1.Text%>到<%=Date2.Text%>入库汇总</h1>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataSourceID="SqlDataSource1" style="text-align: center" BorderColor="Black" 
                BorderStyle="Solid" BorderWidth="2px">
            <RowStyle Height="40px" />
            <Columns>
                <asp:BoundField DataField="Column1" HeaderText="产品" 
                    SortExpression="Column1"  ReadOnly="True" >
                </asp:BoundField>
                <asp:BoundField DataField="名称" HeaderText="名称" 
                    SortExpression="名称" ItemStyle-Width="100">
                </asp:BoundField>
                <asp:BoundField DataField="捆数" HeaderText="捆数" 
                    SortExpression="捆数" ReadOnly="True" ItemStyle-Width="200">
                </asp:BoundField>
                <asp:BoundField DataField="支数" HeaderText="支数" 
                    SortExpression="支数" ReadOnly="True" ItemStyle-Width="200">
                </asp:BoundField>
                <asp:BoundField DataField="重量" HeaderText="重量" ReadOnly="True" 
                    SortExpression="重量" ItemStyle-Width="200">
                </asp:BoundField>
                <asp:BoundField DataField="长度" HeaderText="长度" ReadOnly="True" 
                    SortExpression="长度" ItemStyle-Width="200"/>
            </Columns>
            <HeaderStyle Height="40px" />
        </asp:GridView>
        </div>
    
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
            SelectCommand="SELECT '油管',dbo.原料供货单位.名称, 
       COUNT(*) AS 捆数, 
	   SUM(kc.支数) AS 支数, 
	   SUM(kc.重量) AS 重量, 
	   SUM(kc.长度) AS 长度
FROM dbo.产品库存 AS kc INNER JOIN
     dbo.产品 ON kc.产品类别ID = dbo.产品.ID INNER JOIN
     dbo.原料供货单位 ON kc.原料供货ID = dbo.原料供货单位.ID INNER JOIN
     dbo.产品入库单 AS rk ON kc.入库单ID = rk.ID
WHERE (kc.产品类别ID = 1) AND
      ((kc.入库日期) between '2009-12-01*' and '2010-03-01') AND
      (kc.状态!=0)
GROUP BY dbo.原料供货单位.名称,kc.原料供货ID"></asp:SqlDataSource>
    
    </div>
    </form>
</body>
</html>
